How to calculate the cost function of derivatives in economics